﻿using System.ComponentModel.DataAnnotations;

namespace HengTong.Model.Request;

public class ChangePasswordBySmsRequest
{
    [Required(ErrorMessage = "手机号不能为空")]
    [RegularExpression(@"^1\d{10}$", ErrorMessage = "手机号格式不正确")]
    public string Mobile { get; set; }

    [Required(ErrorMessage = "验证码不能为空")]
    [StringLength(6, ErrorMessage = "验证码长度不正确")]
    public string Code { get; set; }

    [Required(ErrorMessage = "新密码不能为空")]
    [StringLength(50, MinimumLength = 6, ErrorMessage = "新密码长度必须在6-50个字符之间")]
    [RegularExpression(@"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$", ErrorMessage = "新密码必须至少6位且包含字母和数字")]
    public string NewPassword { get; set; }

    [Compare("NewPassword", ErrorMessage = "两次输入的密码不一致")]
    public string ConfirmPassword { get; set; }

    [StringLength(50, ErrorMessage = "原密码长度不能超过50个字符")]
    public string OldPassword { get; set; }
}